#!/usr/bin python3
# -*- coding:UTF-8 -*-
# Author: nigo
import plotly.express as px

# 数据
labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen']
values = [4500, 2500, 1053, 500]
# 创建figure对象，画布和轨迹
fig = px.pie(names=labels,values=values,title='结构图')
# 更新轨迹 文本显示百分比和label名称，文本位置为内部
fig.update_traces(textinfo='percent+label',textposition='inside')
# 甜甜圈
# fig.update_traces(hole=0.3)
# 突出
# fig.update_traces(pull=[0,0,0.2,0])
# 显示画布
fig.show()

